<?php
/***************************************************************
*  Copyright notice
*  (c) 2009, jianyuzhu@gmail.com
*  All rights reserved
*  This script is part of the PPEMI project.
***************************************************************/

class LibJsonCustom {
	
	//constructor
	function LibJsonCustom() {
		
	}
	
	//methods
	//encode
	function encode($data) {
		if( is_array($data) ) {
			return $this->encodeArray($data);
		} elseif( is_object($data) ) {
			return $this->encodeObject($data);
		} else {
			return '"' . $data . '"';
		}
	}
	
	function decode($json) {
		return $this->decodeArray($json);
	}
	
	//encode
	function encodeArray($data) {
		$d = '{';
		foreach($data as $k => $v) {
			$d .= '"' . $k . '":' . $this->encode($v) . ',';
		}
		$d = substr($d, 0, -1);
		$d .= '}';
		
		return $d;
	}
	
	function encodeObject($data) {
		
	}
	
	//decode
	function decodeArray($data) {
		$this->_start = 0;
	}
	
	function decodeObject($data) {
		
	}
}
//
?>